package cn.shyouchi.wuguanjia.android.ui.patrol.statistic;

import android.content.Intent;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.widget.hintprogressbar.HintProgressBar;

/**
 * Created by Eenie on 2017/1/17 at 11:48
 * Email: 472279981@qq.com
 * Des:
 */

public class PatrolMonthStatisticAdapter extends BaseQuickAdapter<PatrolStatisticEntity.ResultMessageBean, BaseViewHolder> {

    public PatrolMonthStatisticAdapter(List<PatrolStatisticEntity.ResultMessageBean> data) {
        super(R.layout.item_patrol_statistic, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, final PatrolStatisticEntity.ResultMessageBean entity) {


        holder.setText(R.id.tv_report_name, entity.getUser().getName());
        holder.setText(R.id.tv_report_time, entity.getDate());

        holder.setText(R.id.tv_turn_complete, String.format("圈数：%s/%s", entity.getRate().getTurn_ring(), entity.getRate().getRing()));

        HintProgressBar turnPro = holder.getView(R.id.turn_progress);
        turnPro.setProgress(entity.getRate().getTurn());

//        holder.setText(R.id.tv_point_total, String.format("总点数：%1s", entity.getRate().getNumber()));
        holder.setText(R.id.tv_point_complete, String.format("点数：%s/%s", entity.getRate().getTurn_actual(), entity.getRate().getTurn_total()));


        HintProgressBar pointPro = holder.getView(R.id.point_progress);
        pointPro.setProgress(entity.getRate().getNumber());


        holder.getView(R.id.tv_check_detail).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, PatrolStatisticActivity.class);
                intent.putExtra("userid", String.valueOf(entity.getUser().getId()));
                intent.putExtra("date",   entity.getDate());

                mContext.startActivity(intent);
            }
        });

    }
}
